package absolute_zero.com.urbox;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

import absolute_zero.com.urbox.transmition.Client;
import android.app.Activity;
import android.app.NotificationManager;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;

/**
 * This activity will process all incoming and outgoing activity.<br>
 * 
 * @author Charles C. Francis
 * @version 0.02a
 * Initial build
 *
 */
public class TransmitionActivity extends Activity 
{
	private TextView header;
	private TextView status;
	private ProgressBar mprogress;
	private Button ok_button;
	private NotificationManager mNotificationManager;
	
	
	public void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		Log.d("Transmition Activity Fires", "Fired");
		
		 mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);  
	        TransmitionActivity.this.mNotificationManager.cancel(1); 
		//Get Screen elements
		setContentView(R.layout.transfer);
		
			
		
		header = (TextView)this.findViewById(R.id.transferring_title);
	    status = (TextView)this.findViewById(R.id.transferring_details);
	    ok_button = (Button)this.findViewById(R.id.ok_button);
	    ok_button.setVisibility(4);
	    header.setText("File Accepted!");
	    status.setText("Recieved Address.  File is being sent in background");
		//Get message from the bundle
		Bundle UserInfo = getIntent().getExtras();
		String message = UserInfo.getString("message");
		String address = UserInfo.getString("address");
		//process the message to get the IP
		String IP = message.replace("UrBox_reponse", "");
		Log.d("I got it!", IP);
		
		ok_button.setOnClickListener(new OnClickListener(){

			public void onClick(View v) {
				finish();
				
			}
			
		});
		ok_button.setVisibility(0);
	}
}
